<template>
  <div class="shop">
    {{msg}}
    <div class="ads" v-if="ads.length">
        <swipe class="" :auto="5000">
            <swipe-item class="slide1" v-for="ad in ads" :key="ad.id" >
                <img :src="ad.data.imageUrl" alt="">
            </swipe-item>
        </swipe>
    </div>
    <router-view></router-view>
  </div>
</template>

<script>
    import config from '../../config';
    import {doget,basic,ingfrast} from '../../config/api';
    //import axios from 'axios'

    export default {
        data () {
            return {
                msg: '',
                ads:[]
            }
        },
        watch:{
        },
        methods:{
            getmsg(){
                
                var me=this;
                doget(basic('Eatown/Message/PickupMore')).then(function(res){
                    me.msg=res.data.content;
                })
                
            },
            getAds(){
                doget(ingfrast('Ads'),{
                    application: 'Eatown2',
                    channel: 'LianLian',
                    version: '1.0.0',
                    platform: 'Hybrid',
                    from: '',
                    position: 'shopBanner'
                }).then(res=>{
                    if(res.statusCode===200){
                         let result=res.data;
                         this.ads=result.items;
                    }
                   
                })

            }
        },
        created(){
            this.getmsg()
            this.getAds()
        }
    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style  lang="scss" scoped>
    .shop{
        position:absolute;
        left:0;
        top:0;
        right:0;
        bottom:0;
        background:pink;
        color:red;
        .ads{
            height:140px;
            img{width:100%}
        }
    }
</style>
